﻿@{
   
    Layout = "/Views/Shared/_Layout.cshtml";
}
@using Kaiser.Cubic.Service
@using Kaiser.Extensions;
@model Kaiser.Cubic.Service.ProductDetail
@{
    var service = new CubicServiceClient();
    var productModel = service.GetProduct(Request["id"])??new ProductDetail();
    var category = service.GetProductCategory(productModel.CategoryId)??new ProductCategory();
    ViewBag.Title = productModel.ProductName + " | " + category.ParentName ?? string.Empty;
} 
 
@*<link href="/Scripts/qtip/jquery.qtip.min.css" rel="stylesheet" />
<script src="/Scripts/qtip/jquery.qtip.min.js"></script>*@
<link href="/Scripts/lightbox/css/lightbox.css" rel="stylesheet" />
<script src="/Scripts/lightbox/js/lightbox-2.6.min.js"></script>
<script>
    $(function () {

        $(".cp_1_word").each(function () {
            //  var obj = $(this);
            //  var text = obj.text();
            //  var html = obj.html();
            //{
            //      obj.html(text);
            //  }

            //obj.qtip({
            //    content: {
            //        text: html

            //    },
            //    position: {
            //        my: 'left center',
            //        at: 'center right',
            //    }
            //});
            //   obj.limittext({ "limit": 200, "fill": "......" });
        });



    })
</script>
<div class="index_center">
    <div class="bg"></div>
    <div class="conBg">
        @RenderPage("/Views/Shared/Menu.cshtml")
        <div class="erBanner">

            <a href="#">
                @if (productModel.TopPic != null)
                {
                    @:<img src="@productModel.TopPic.Url" />
                }

            </a>

        </div>
        <div class="ercon">
            <div class="erconTitle"><a href="/">Home</a><span>></span><a href="#">Products</a><span>></span><a href="#">@category.ParentName</a><span>></span><em>@productModel.ProductName</em></div>
            <div class="erLeft">
                <div class="erLeftTitle">Products</div>
                <div class="erLeft_1">
                    @Html.Partial("ProductTreeMenu")
                </div>
            </div>
            <div class="erRight">
                <div class="cpTitle">Description</div>
                <div class="cp">
                    @(new HtmlString(System.Web.HttpContext.Current.Server.UrlDecode(productModel.EnglishDehumidifierDescription)))
                </div>
                @if (productModel.Photos.Any())
                {
                    <div class="cpTitle">Features</div>
                    <div class="cp_1">
                        @foreach (var photo in productModel.Photos)
                        {
                            <div class="cp_1_all">
                                <div class="cp_1_pic">
                                    <a href="#">
                                        <img src="@photo.Url" /></a>
                                </div>
                                <div class="cp_1_word">
                                    @(new HtmlString(System.Web.HttpContext.Current.Server.UrlDecode(photo.Description ?? string.Empty).CleanHtmlTags().Substr(420)))
                                </div>
                            </div>
                        }
                    </div>
                }
                @if (productModel.Files.Any())
                {
                    <div class="cpTitle">Download</div>
                    <div class="cp_1">
                        @foreach (var item in productModel.Files)
                        {
                            <div class="cp_2"><span>@item.FileName</span><a  target="_blank" href='@Url.Action("DownLoad", "Adapter", new { area = "China",u=Server.UrlEncode(item.Url),d=Server.UrlEncode(item.FileName)  })'><img width="120px" height="40px" style="margin-top: -10px;" src="/images/cp_11.png" /></a></div>
                        }
                    </div>   
                }
            </div>
        </div>
        @RenderPage("/Views/Shared/Foot.cshtml")
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {

        $(".cp_1_pic img").each(function () {
            var obj = $(this);

            var a = $("<a href='" + obj.attr("src") + "'></a>");
            a.attr("data-lightbox", "roadtrip");

            $(this).wrap(a);
        });
    });
</script>
